package com.plugin.manage.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.plugin.manage.pojo.dto.ElderAssessmentInfoDTO;
import com.plugin.manage.pojo.vo.ElderAssessmentVO;
import com.plugin.manage.common.PageResult;
import com.plugin.manage.mapper.ElderAssessmentMapper;
import com.plugin.manage.service.IElderAssessmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 老人评估信息服务实现类
 *
 * @author mark
 * @date 2025-08-01
 */
@Slf4j
@Service
public class ElderAssessmentServiceImpl implements IElderAssessmentService {

    @Autowired
    private ElderAssessmentMapper elderAssessmentMapper;

    @Override
    public PageResult<ElderAssessmentInfoDTO> getElderAssessmentInfo(Long current, Long size) {
        // 创建MyBatis-Plus分页对象
        Page<ElderAssessmentInfoDTO> page = new Page<>(current, size);
        Page<ElderAssessmentInfoDTO> resultPage = (Page<ElderAssessmentInfoDTO>) elderAssessmentMapper.getElderAssessmentInfo(page);
        return PageResult.of(resultPage);
    }
    
    @Override
    public ElderAssessmentVO getElderAssessmentDetail() {
        log.info("获取长者评估详细信息");
        ElderAssessmentVO elderAssessmentVO = elderAssessmentMapper.getElderAssessmentDetail();
        log.info("获取长者评估详细信息成功");
        return elderAssessmentVO;
    }
}
